#! /usr/bin/php
<?php
/**
 * Copyright (c) 2006-2008, Julien PORTALIER
 * http://featherphp.googlecode.com/
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 */

# basics
define('DS',       DIRECTORY_SEPARATOR);
define('FEATHER',  dirname(__FILE__).DS.'feather3'.DS);
require FEATHER.'basics.php';

if ($_SERVER['argc'] < 2) {
	die("Error: nothing to do.\n");
}

# paths
define('APP',      $_SERVER['PWD'].DS);
define('ROOT',     dirname(APP).DS);
define('SCRIPTS',  APP.'scripts'.DS);
define('WWW_ROOT', APP.'webroot'.DS);
define('PROTOCOL', 'http://');
define('TMP',      APP.'tmp'.DS);
define('CACHE',    TMP.'cache'.DS);

# feather's core
require APP.'config'.DS.'core.php';
require FEATHER.'libs'.DS.'dispatcher.php';

# dispatch
Dispatcher::init();
Dispatcher::script(
	$_SERVER['argv'][1],
	isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : 'main',
	array_slice($_SERVER['argv'], 3)
);
?>